package com.sskj.gocoin.utils;

/**
 * Created by Administrator on 2017/12/6 0006.
 */

public class HtmlUtils {

    /**
     * 添加头部
     */
    public static String getHtmlData(String bodyHTML) {
        String head = "<head>" +
                "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\"> " +
                "<style>img{max-width: 100%; width:auto; height:auto;}</style>" +
                "</head>";
        return "<html>" + head + "<body style='background:#222324;color:white;'>" + bodyHTML + "</body><ml>";
    }

    public static String getHtmlFormatData(String bodyHTML){
        String content = "<!doctype html><html>\n<meta charset=\"utf-8\"><style type=\"text/css\">body{padding:0; margin:0;}\n." +
                "view_h1{ width:100%%;display:block; overflow:hidden;  margin:0 auto; font-size:1.2em; color:#333; padding:2em 0; line-height:1.0em; }\n." +
                "view_time{ width:100%%;  margin:0 auto;display:block; overflow:hidden; font-size:0.8em; color:#999;}\n." +
                "con{width:100%%; margin:0 auto; color:#fff; color:#333; padding:0.5em 0; overflow:hidden; display:block; font-size:0.92em; line-height:1.8em;}\n." +
                "con h1,h2,h3,h4,h5,h6{ font-size:1em;}\n .con img{width: 100%; ;height: auto;margin:0 auto;  display:block; text-align:center;overflow:hidden; margin:0 auto;}\n" +
                "</style>\n<body style=\"padding:0; margin:0; \">"
                + "</div><div class=\"con\">"
                + bodyHTML
                + "</div></body></html>";
        return content;
    }

    public static String getHtmlFormatLongPic(String imgUrl){
        String str1 = "<!DOCTYPE html><html><head lang=\"en\"><meta charset=\"utf-8\" /><meta name=\"keywords\" content=\" \" /><meta name=\"description\" content=\" \" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=no\" />    <meta name=\"format-detection\" content=\"telephone=no\" />    <title></title>    <style type=\"text/css\">        html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video, hr, dialog {            margin: 0;            padding: 0;            border: 0;            font-style: normal;        }    a {        color: #51545a;    }    left {        float: left;    }    /*\u7981\u6b62\u9875\u9762a\u6807\u7b7e\u4e2dhref\u957f\u6309\u5f39\u51fa\u590d\u5236\u5bf9\u8bdd\u6846*/    html, body {        -webkit-touch-callout: none;        -webkit-text-size-adjust: none;        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);        -webkit-user-select: none;    }    body {        margin: 0;        padding: 0;        color: #51545a;    }    .mt10 {        margin-top: 0.625em;    }    article, aside, details, hgroup, nav, span {        display: inline-block;    }    footer, header, section, dialog, menu, label, strong, var, em, del, time, figcaption, figure, pre, small, mark, cite, code, fieldset, button {        display: block;    }    #main {        position: absolute;        top: 0;        left: 0;        width: 100%;        height:auto%;        display: -webkit-box;        -webkit-box-orient: vertical    }    .content{ width:95%; margin:0 auto; display:block; overflow:hidden;font-size:0.92em; line-height:1.8em;padding:0.5em 0;} \n .content img{width: auto; max-width: 100%;height: auto;margin:0 auto;display:block; border:0;}   .content .title{ width:100%; height:2.5em; background:#f3f3f3;}    .content .title p{ padding-left:0.8em; line-height:2.5em; font-size:1em; color:#333;}    .content .tuwen{ width:100%; display:block; overflow:hidden; padding:1em 0; border-bottom:0.0625em solid #d9d9d9; }    .content .tuwen .tuwen_l{ float:left; padding-left:0.5em;}    .content .tuwen .tuwen_l img{ width:3em; height:3em; display:block;}    .content .tuwen .tuwen_r{ float:left; width:73%; margin-left:1em;}    .content .tuwen .tuwen_r .p1{ font-size:0.875em; color:#333; margin-bottom:0.5em;}    .content .tuwen .tuwen_r .p2{ font-size:0.75em; color:#999;}    </style></head><body><div id=\"main\"><section>   <div class=\"content\"> ";
        String str2 ="</div></section></div></body></html>";
        return str1 + "<img src='"+imgUrl+"' />" + str2;
    }
}
